<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // rest 和 spread 运算符
        // rest 相当于java中的可变参数，将数组中的元素转化为参数
        // rest 例子
        function fun(a,b,...arr){
            console.log(a,b,arr); 
        }
        fun(1,2,3,4,5);
        // spread 相当于java中的数组，将参数转化为数组
        // spread 例子
        function fun2(a,b,c){
            console.log(a,b,c);
        }
        let arr = [1,2,3];
        fun2(arr) // a = [1,2,3], b = undefined, c = undefined;
        fun2(...arr); // a = 1, b = 2, c = 3;
        // 数组的合并
        let arr1 = [1,2,3];
        let arr2 = [4,5,6];
        let arr3 = [...arr1,...arr2]; // [1,2,3,4,5,6]
    </script>
</head>
<body>
    
</body>
</html>